nums = [4,1,2,1,2]


var singleNumber = function(nums) {
    let res=0
    for(let i=0;i<nums.length;i++)
    {
       res=res^nums[i]
    }
    return res
};
console.log(singleNumber(nums));
